[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
textbackground() Set the Background Color
#include <conio.h>
void textbackground(color);
int color;
textbackground() sets the background text color. The only text
affected by a call to textbackground() is that which is displayed
using direct console output functions after textbackground() is
called. 'color' is an integer value from 0 to 7.
(Color information is represented by an 8-bit value: the four lowest
bits represent the foreground color (0-15). The next three bits
represent the background color(0-7). The high bit is the blink-
enable bit. If this bit is on, the character will blink. The symbolic
constant BLINK is defined in <conio.h> and can be added to the
foreground and/or background color(s) to make the character blink.
Use textattr() to set the foreground and background colors in one
call, and textcolor() to set the foreground color only.)
The allowable colors, their symbolic constants and corresponding
values are defined in <conio.h> :
Symbolic constant Value Foreground &/or Background
BLACK 0 Both
BLUE 1 Both
GREEN 2 Both
CYAN 3 Both
RED 4 Both
MAGENTA 5 Both
BROWN 6 Both
LIGHTGRAY 7 Both
DARKGRAY 8 Foreground
LIGHTBLUE 9 Foreground
LIGHTGREEN 10 Foreground
LIGHTCYAN 11 Foreground
LIGHTRED 12 Foreground
LIGHTMAGENTA 13 Foreground
YELLOW 14 Foreground
WHITE 15 Foreground
BLINK 128 Foreground
Note that because the background color is set using only 3 bits, only
the first eight colors can be used.
Returns: Nothing.
Portability: IBM PC and BIOS compatibles only.
------------------------------ Example ---------------------------------
The following statements print a blinking message in yellow text on a
green background.
#include <conio.h>
main()
{
textcolor(YELLOW + BLINK);
textbackground(GREEN);
cputs("YOU'LL SEE BLINKING YELLOW TEXT ON A GREEN
BACKGROUND.");
}
See Also:
textattr()
textcolor()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson